package com.lee;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010;
import org.apache.flink.streaming.util.serialization.SimpleStringSchema;
import org.apache.flink.util.Collector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Properties;

/**
 * Created by liruopeng on 2017/10/27.
 */
public class SplitTest {
    public static void main(String[] args) throws Exception {

        final Logger LOG = LoggerFactory.getLogger(PcapETL.class);

        // set up the execution environment
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<String[]> stream = env
                .readTextFile("/Users/liruopeng/Downloads/flink-test.txt")
                .flatMap(new FlatMapFunction<String, String[]>() {
                    @Override
                    public void flatMap(String value, Collector<String[]> out)
                            throws Exception {
                        out.collect(value.split("\\|"));
                    }
                });

        stream.print();
        env.execute();
    }
}
